Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap the managed worker thread pool to disallow shutdown on prod mode #43268

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

ozangunalp
Copy link
Contributor

Seen in #43228 : when injected the worker thread pool can be shutdown preemptively by extensions and app during the shutdown sequence.
This change disallows them to shutdown the worker executor service on prod mode.

@mkouba , @cescoffier

managed = new ManagedScheduledExecutorService(underlying);
}
current = managed;
return managed;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, isn't the Vert.x worker thread pool backed by this very ExecutorService in the prod mode? If so, then we could remove the vertx-specific stuff for the prod mode here: https://github.com/quarkusio/quarkus/blob/main/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java#L110

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's try to simplify the code! Except that we don't have a test for this. I guess that we could at least try to run the reproducer from #16833 manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let me remove the draft to run the existing test suite. I can also reproduce with #43228.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we allow the shutdown only on dev mode. It'd be better if tests were closer to prod.

@ozangunalp ozangunalp force-pushed the worker_pool_disallow_shutdown branch from faee35e to 79ed309 Compare September 13, 2024 15:50
@ozangunalp ozangunalp marked this pull request as ready for review September 13, 2024 15:50
@ozangunalp ozangunalp added the triage/needs-decision This issue proposes a design change. Needs to be discussed in the ML label Sep 13, 2024

This comment has been minimized.

@ozangunalp ozangunalp force-pushed the worker_pool_disallow_shutdown branch 2 times, most recently from 68822e5 to c7ad32e Compare September 17, 2024 08:51
@ozangunalp
Copy link
Contributor Author

@mkouba I've kept the note.
I've added a small test to the vert.x extension and with the reproducer on #43228

@ozangunalp ozangunalp force-pushed the worker_pool_disallow_shutdown branch from c7ad32e to c42c057 Compare September 17, 2024 09:04
@mkouba
Copy link
Contributor

mkouba commented Sep 17, 2024

From my POV this pull request is ready for merge but let's wait for CI and @cescoffier!

This comment has been minimized.

@ozangunalp
Copy link
Contributor Author

I'll push again, formatting error...

@ozangunalp ozangunalp force-pushed the worker_pool_disallow_shutdown branch from c42c057 to c37ec43 Compare September 17, 2024 09:19
Copy link

quarkus-bot bot commented Sep 17, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit c37ec43.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/micrometer/deployment

io.quarkus.micrometer.deployment.binder.VertxTcpMetricsTest.testTcpMetrics - History

  • event executor terminated - java.util.concurrent.RejectedExecutionException
java.util.concurrent.RejectedExecutionException: event executor terminated
	at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:931)
	at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:350)
	at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:343)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:833)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute0(SingleThreadEventExecutor.java:824)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:814)
	at io.vertx.core.impl.EventLoopExecutor.execute(EventLoopExecutor.java:35)

@gsmet gsmet requested a review from cescoffier September 24, 2024 11:21
@ozangunalp ozangunalp removed the triage/needs-decision This issue proposes a design change. Needs to be discussed in the ML label Sep 24, 2024
@ozangunalp ozangunalp merged commit 5c3ad82 into quarkusio:main Sep 24, 2024
52 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.16 - main milestone Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants